package com.yape.controller;

import com.yape.stockService.INewStockService;
import com.yape.response.Response;
import com.yape.vo.NewStockListingVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author yape
 * @description
 * @date 2025/5/24 21:46
 */
@RestController
@RequestMapping("/api/ipos/")
@CrossOrigin("*")
@Slf4j
public class NewStockController {

    @Resource
    private INewStockService newStockService;

    @GetMapping("calendar")
    public Response<NewStockListingVO> getNewStockListing(@RequestParam int page, @RequestParam int size) {
        log.info("获取新股上市列表，第{}页，每页数量{}", page, size);
        NewStockListingVO newStockListingVO = newStockService.queryNewStockListing(page, size);
        return Response.<NewStockListingVO>builder()
                .code("200")
                .message("success")
                .data(newStockListingVO)
                .build();
    }
}
